# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidPublisher.V3.Model.RegionalPriceMigrationConfig do
  @moduledoc """
  Configuration for migration of a legacy price cohort.

  ## Attributes

  *   `oldestAllowedPriceVersionTime` (*type:* `DateTime.t`, *default:* `nil`) - Required. Subscribers in all legacy price cohorts before this time will be migrated to the current price. Subscribers in any newer price cohorts are unaffected. Affected subscribers will receive one or more notifications from Google Play about the price change. Price decreases occur at the subscriber's next billing date. Price increases occur at the subscriber's next billing date following a notification period that varies by region and price increase type.
  *   `priceIncreaseType` (*type:* `String.t`, *default:* `nil`) - Optional. The requested type of price increase
  *   `regionCode` (*type:* `String.t`, *default:* `nil`) - Required. Region code this configuration applies to, as defined by ISO 3166-2, e.g. "US".
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :oldestAllowedPriceVersionTime => DateTime.t() | nil,
          :priceIncreaseType => String.t() | nil,
          :regionCode => String.t() | nil
        }

  field(:oldestAllowedPriceVersionTime, as: DateTime)
  field(:priceIncreaseType)
  field(:regionCode)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V3.Model.RegionalPriceMigrationConfig do
  def decode(value, options) do
    GoogleApi.AndroidPublisher.V3.Model.RegionalPriceMigrationConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V3.Model.RegionalPriceMigrationConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
